package com.heima.feign.article;

import com.heima.feign.article.fallback.ArticleClientFallback;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.behavior.dtos.LikeBehaviorDto;
import com.heima.model.article.dtos.CollectionBehaviorDto;
import com.heima.model.behavior.dtos.ReadBehaviorDto;
import com.heima.model.comment.dto.CommentConfigDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmCommentDto;
import com.heima.model.wemedia.dtos.GraphicDataParametersDto;
import com.heima.model.wemedia.pojos.NewPage;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author jack
 * @data 2024 15:12
 */
@FeignClient(value = "leadnews-article", fallback = ArticleClientFallback.class)
public interface IArticleClient {

    /**
     * 新增或修改app文章信息
     *
     * @param articleDto
     * @return
     */
    @PostMapping("/api/v1/article/saveOrUpdate")
    ResponseResult saveArticle(@RequestBody ArticleDto articleDto);

    @PostMapping("/api/v1/article/getComments")
    PageResponseResult getComments(@RequestBody WmCommentDto wmCommentDto);

    @PostMapping("/api/v1/article/updateCommentStatus")
    ResponseResult updateCommentStatus(@RequestBody CommentConfigDto wmUpdateStatusDto);
    @PostMapping("/api/v1/article/addLike")
    ResponseResult addLike(@RequestBody LikeBehaviorDto likeBehaviorDto);

    /**
     * 通过文章ID查找文章配置
     *
     * @param articleId 文章ID
     * @return {@link ResponseResult}<{@link ?}>
     */
    @GetMapping("/api/v1/article/findArticleConfigByArticleId/{articleId}")
    ResponseResult<?> findArticleConfigByArticleId(@PathVariable("articleId") Long articleId);

    @PostMapping("/api/v1/article/readBehavior")
    ResponseResult readBehavior(@RequestBody ReadBehaviorDto readBehaviorDto);

    @PostMapping("/api/v1/article/addCollection")
    ResponseResult addCollection(CollectionBehaviorDto collectionBehaviorDto);

    @PostMapping("/api/v1/article/addComment/{articleId}")
    ResponseResult addComment(@PathVariable("articleId")Long articleId);


    @PostMapping("/api/v1/article/newPage")
    PageResponseResult newPage(@RequestBody NewPage newPageDto);

    @PostMapping("/api/v1/article/graphicAndTextualData")
    ResponseResult graphicAndTextualData(GraphicDataParametersDto graphicDataParametersDto);

    @GetMapping("/api/v1/article/deletingCommentsReducesComments/{entryId}/{count}")
    void deletingCommentsReducesComments(@PathVariable("entryId") Long entryId, @PathVariable("count") Long count);
}
